/**
 * 
 */
package com.cbank.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cbank.dao.UserAccountDao;
import com.cbank.domain.UserAccount;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:cBank
 * </p>
 * <p>
 * Contact: 1027448479@qq.com
 * </p>
 * 
 * @author Ag
 * @date 2016年12月13日
 */
@Service
public class UserAccountService {
	@Autowired
	private UserAccountDao userAccountDao;

	public void save(UserAccount obj) {
		UserAccount u = userAccountDao.getByViewId(obj.getViewId());
		if (u == null) {
			this.userAccountDao.insert(obj);
		} else {
			this.userAccountDao.update(obj);
		}
	}

	public UserAccount getByViewId(Long viewId) {
		UserAccount u = userAccountDao.getByViewId(viewId);
		return u;
	}


	public UserAccount getById(Long id) {
		UserAccount u = userAccountDao.getById(id);
		return u;
	}
	public UserAccount getByUserId(Long id) {
		UserAccount u = userAccountDao.getByUserId(id);
		return u;
	}

	public Integer getCount() {
		return userAccountDao.getCount();
	}

}
